package com.yksj.healthtalk.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class BuythingEntity implements Serializable{

	private String sellerName;
	private String describe;
	private String date;
	private String moneyNum;
	private String addressImage;
	private String id;
	private String filePath;
	private String clientId;
	private String STATUS;//状态 "" 或者 已退
	private String TYPENAME;//服务类型
	private String CUSTOMER_SEX;
	
	public String getCUSTOMER_SEX() {
		return CUSTOMER_SEX;
	}
	public void setCUSTOMER_SEX(String cUSTOMER_SEX) {
		CUSTOMER_SEX = cUSTOMER_SEX;
	}
	public String getTYPENAME() {
		return TYPENAME;
	}
	public void setTYPENAME(String tYPENAME) {
		TYPENAME = tYPENAME;
	}
	public String getSTATUS() {
		return STATUS;
	}
	public void setSTATUS(String status) {
		this.STATUS = status;
	}
	
	public String getClientId() {
		return clientId;
	}
	public void setClientId(String clientId) {
		this.clientId = clientId;
	}
	public String getFilePath() {
		return filePath;
	}
	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getAddressImage() {
		return addressImage;
	}
	public void setAddressImage(String addressImage) {
		this.addressImage = addressImage;
	}
	public String getSellerName() {
		return sellerName;
	}
	public void setSellerName(String sellerName) {
		this.sellerName = sellerName;
	}
	public String getDescribe() {
		return describe;
	}
	public void setDescribe(String describe) {
		this.describe = describe;
	}
	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date = date;
	}
	public String getMoneyNum() {
		return moneyNum;
	}
	public void setMoneyNum(String moneyNum) {
		this.moneyNum = moneyNum;
	}
	/**
	 * 将json转化为集合
	 * @return
	 */
	public static List<BuythingEntity> getParseToList(String json){
		List<BuythingEntity> entities=null;
		 try {
			 JSONArray object=new JSONArray(json);
			 entities=new ArrayList<BuythingEntity>();
			 for (int i = 0; i < object.length(); i++) {
				 BuythingEntity entitie=new BuythingEntity();
				 JSONObject object2 = (JSONObject)object.get(i);
				 entitie.setSellerName(object2.getString("NAME"));
				 entitie.setDate(object2.getString("TIME"));
				 entitie.setId(object2.getString("ID"));
				 entitie.setTYPENAME(object2.optString("TYPENAME", ""));
				 entitie.setClientId(object2.optString("CUSTOMERID", ""));
				 entitie.setAddressImage(object2.getString("ICONPATH"));
				 entitie.setDescribe(object2.getString("TYPE"));
				 entitie.setFilePath(object2.getString("PATH"));
				 entitie.setMoneyNum(object2.getString("CHARGING"));
				 entitie.setSTATUS(object2.getString("STATUS"));
				 entitie.setCUSTOMER_SEX(object2.optString("CUSTOMER_SEX"));
				 entities.add(entitie);
			}
			 return entities;
		} catch (JSONException e) {
			return null;
		}
	}
}
